Technical Field
This disclosure relates to computing systems, and more particularly, to a memory initialization detection system.
Description of the Related Art
Memory initialization errors occur when a program attempts to access a memory location that has not been previously written to. One example of such an error occurs when a computer program allocates a memory location and then attempts to read from the allocated memory location prior writing any values at that memory location. When the value retrieved from the memory location is later used by the computer program, it may lead either to a program crash or to unexpected program behavior. Some programming languages (for example, C and C++) include features such as explicit memory management and pointer arithmetic. These features allow development of efficient applications and system software. However, when a computer programmer incorrectly uses these features, memory initialization errors may occur.
A computer programming language may be characterized as “type safe” when the language does not permit a computer programmer to use a value as a data type to which it does not belong. For example, a type safe programming language does not allow conversion of an integer variable to a pointer value. The C programming language is one example of a “type unsafe” language due to casting, particularly the casting of pointers to void pointers and back. The C++ programming language includes most of the C programming language as a subset. Therefore, the C++ programming language inherits the “type unsafe” property.
A computer programming language may be characterized as “memory safe” when the language allows programs to release a portion of memory when it is determined the portion of memory is unused for the remainder of the program evaluation. A programming language that is “memory unsafe” may cause security vulnerabilities with random-access memory (RAM) access, such as buffer overflows and dangling pointers. Programming languages, such as C and C++, that support arbitrary pointer arithmetic, casting, and deallocation are typically “memory unsafe.” Some high-level programming languages are memory safe due to disallowing pointer arithmetic and casting, and enforcing tracing garbage collection. However, programming efficiency may be reduced.
When a memory initialization error is detected, precise identification and/or prevention of a memory access instruction that caused the error and the associated program state may be very helpful to application developers (e.g., for debugging purposes).